/**
 *  路由配置配置文件
 */
// 导入 创建路由对象的函数
import { 
  createRouter, 
  createWebHashHistory} from 'vue-router';

import Login from '../Login.vue';
import Home from '../Home.vue';
import  NotFound from '../NotFound.vue';

// 创建 路由对象
const router = createRouter({
  
  history: createWebHashHistory(),
  routes: [
    {
      path:'/',
      component:Login
    },
    {
      path: '/home/:urlPath',
      component: Home,
      beforeEnter: (to, from, next) => {
        if (to.params.urlPath === 'comp1') {
          next();
        } else {
          next('/404');
        }
      }
    },
    {
      path: '/404',
      component: NotFound
    }
  ]
});




// 导出路由对象
export default router;